package com.jing21.learn.intf.feignclients;

import com.github.pagehelper.PageInfo;
import com.jing21.learn.common.learn.PageQuery;
import com.jing21.learn.intf.entity.LearnUser;
import com.jing21.learn.intf.entity.Product;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * Created by 郑靖 on 2017/9/28.
 */
@RequestMapping("/user")
@FeignClient(value = "basic-service")
@Api(value = "UserClient", description = "用户查询服务")
public interface UserClient extends com.jing21.learn.intf.feignclients.BasciClient {

    @ApiOperation("保存用户")
    @RequestMapping(value = "/{id}", method = RequestMethod.POST)
    boolean save(@RequestBody LearnUser user);

    @ApiOperation("通过手机号码 或者email 或者用户名 单行查询")
    @RequestMapping(value = "/findByUnque", method = RequestMethod.GET)
    LearnUser findByLogin(@RequestParam("loginname") String loginname);

    @ApiOperation("分页查询")
    @RequestMapping(value = "/_search", method = RequestMethod.POST)
    PageInfo<Product> selectByPage(@RequestBody PageQuery<LearnUser> query);

    @ApiOperation("单行查询")
    @RequestMapping(value = "/_find", method = RequestMethod.POST)
    LearnUser selectOne(@RequestBody LearnUser learnUser);

    @ApiOperation("单行查询")
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    LearnUser selectById(@PathVariable("id") Long id);
}
